package com.yanqu.road.server.manger.activity.businessreunion;

import com.yanqu.road.entity.activity.ActivityConfig;

import java.util.Map;
import java.util.Objects;

/**
 * @author ：zfr
 * @date ：2022/4/18 10:17
 */
public class ReunionConfig {
    private int exchangeScoreItemId;        //商海重逢积分道具id
    private int returnResetTime;            //重置玩家回归状态时间(天)
    private int recallOneAddIntegral;       //邀请1个玩家可获得积分数量
    private int recallAddIntegralLimit;     //邀请玩家可获取积分上限
    private int addIntegralPerAddVipExp;    //邀请的玩家每获得1点贵族经验可获得积分数量
    private int vipExpAddIntegralLimit;     //邀请玩家增加贵族经验增加积分上限
    private String bindReward = "";         //填写邀请码可获得奖励


    public ReunionConfig(Map<String, ActivityConfig> configMap) {
        for (Map.Entry<String, ActivityConfig> configEntry : configMap.entrySet()) {
            if (Objects.equals("EXCHANGE_SCORE_ITEM_ID", configEntry.getKey())) {
                exchangeScoreItemId = configEntry.getValue().getIntValue();
            } else if (Objects.equals("REUNION_RESET_TIME", configEntry.getKey())) {
                returnResetTime = configEntry.getValue().getIntValue();
            } else if (Objects.equals("REUNION_INVITE_PLAYER", configEntry.getKey())) {
                String value = configEntry.getValue().getValue();
                String[] split = value.split("\\|");
                recallOneAddIntegral = Integer.parseInt(split[0]);
                recallAddIntegralLimit = Integer.parseInt(split[1]);
            } else if (Objects.equals("REUNION_VIP_EXP", configEntry.getKey())) {
                String value = configEntry.getValue().getValue();
                String[] split = value.split("\\|");
                addIntegralPerAddVipExp = Integer.parseInt(split[0]);
                vipExpAddIntegralLimit = Integer.parseInt(split[1]);
            } else if (Objects.equals("REUNION_AWARD_TRUE", configEntry.getKey())) {
                bindReward = configEntry.getValue().getValue();
            }
        }
    }

    public int getExchangeScoreItemId() {
        return exchangeScoreItemId;
    }

    public int getReturnResetTime() {
        return returnResetTime;
    }

    public int getRecallOneAddIntegral() {
        return recallOneAddIntegral;
    }

    public int getAddIntegralPerAddVipExp() {
        return addIntegralPerAddVipExp;
    }

    public int getRecallAddIntegralLimit() {
        return recallAddIntegralLimit;
    }

    public int getVipExpAddIntegralLimit() {
        return vipExpAddIntegralLimit;
    }

    public String getBindReward() {
        return bindReward;
    }
}
